package com.wltt.product.frfront.config.javafx;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.springframework.core.io.ClassPathResource;
import oshi.SystemInfo;
import oshi.hardware.HardwareAbstractionLayer;
import oshi.hardware.PowerSource;

import java.io.IOException;
import java.net.URL;

public class JavaFxApplication extends Application {

    public static URL url;

    @Override
    public void start(Stage stage) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(url);

        Scene scene = new Scene(fxmlLoader.load(), 320, 200);

        Image icon = new Image(new ClassPathResource("icon/logo.jpg").getInputStream());
        stage.getIcons().add(icon);

        stage.setTitle("登录");
        stage.setScene(scene);

        stage.setOnCloseRequest(event -> {
            System.exit(0);
        });



//        Scene scene = new Scene(fxmlLoader.load(), 1350, 850);
//
        scene.getStylesheets().addAll("css/style.css");
//
//        stage.initStyle(StageStyle.UNDECORATED);
//        stage.setFullScreen(true);
//
//        Image icon = new Image(new ClassPathResource("icon/logo.jpg").getInputStream());
//        stage.getIcons().add(icon);
//
//        stage.setTitle("Weld Tool");
//        stage.setScene(scene);
//
//        stage.setOnCloseRequest(event -> {
//           System.exit(0);
//        });

        stage.show();
    }

}